home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
089a.dms
/
089a.adf
/
TEXTS
/
CHAPTERS_21-30
/
chapter30.txt
< prev
next >
Wrap
Text File
|
1992-02-26
|
4KB
|
110 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter Thirty
------------------
In chapter 26 I showed you how to execute Amigados programs from within
Amos. In this chapter we will take things one step further and actually
integrate the executable program in our Amos listing. This will have
the advantages of not having to load the program from disk and
means your program will all be in one neat Amos program.
Another benefit is that you won't need to make sure the program is available
to your Amos code as it will be inside it already.
I will show you how to solve the problem of neatly displaying
text files, such as program instructions, using the PD utility PPMore.
The author of PPMore (Nico Francois) has done all the hard work for us,
all we need to do is pass a text file to it to display.
If we were using PPMore from Workbenche's CLI and we wanted to display a
text file called readme.doc, we would use the following:
PPMore readme.doc
And this would run PPMore and it would automatically load and display the
readme.doc.
So, first of all how do we get PPMore to be INSIDE our Amos code?
We just load it into an Amos bank of course. Here is how to do it:
---------------------------------------
Load up Amos
Go into DIRECT MODE (Press Escape)
Type in the following:
----------------------
Reserve as Chip Data 10,7180 ;Reserve the EXACT amount of bytes used by
the program you want to load in. Note
check the size yourself as this is a
crunched ppmore I am using.
Bload "SYS:c/PPmore",10 ; Bload the program into a bank.
Now PPmore is stored in bank 10, when you save off the Amos program,
bank 10 will be saved with it.
A few notes:
As mentioned you must reserve the EXACT amout of bytes of PPMore, this
will depend on the version of PPMore you are going to load and wether it is
crunched or not. You can find the size by doing a DIR in direct mode.
When you do the Bload, you will have to specify the correct path.
If you are not sure, copy PPMore to the Ram disk and use:
Bload "Ram:PPmore",10
PPMore should now be loaded into bank 10. To check this type LISTBANK.
Going back to the editor (press escape) type this in as the first line of
your program:
Bsave "ram:ppmore",Start(10) To Start(10)+Length(10)
This puts PPmore into the Ram disk ready for use each time the Amos program
is run.
Now we need a text file for PPmore to display, this could be the
instructions to your program. For this example we will assume we
have the file readme.doc on the disk in DF0:
Amos To Back
COMMAND$="ram:ppmore DF0:Readme.doc"
Dreg(1)=Varptr(COMMAND$)
Dreg(2)=0
Dreg(3)=0
XEXECUTE=Doscall(-222)
Amos To Front
All the above lines were covered in chapter 26. The only difference being
the contents of COMMAND$.
When you run this Amos will disappear and PPmore will open itself on the
Workbench screen and load up "readme.doc".
The user can now use PPmore as usual to read your instructions.
When the user quits PPmore he will be magically transported back to Amos
where your program can contine executing as normal.
You can do this with virtually ANY program you want, which makes Amos
extremely flexible, the mind boggles at what you can get up to.
Some notes about PPmore:
* You will need Powerpacker.Library in Libs of Sys: (The disk booted from)
* If you want the PRINT option to work you will have to set up the printer
driver etc. on the boot disk.
Take a look at Example30.Amos which is set up to read the Help.txt text file
from this disk. Press escape when you want to return back to Amos.
I would suggest giving the author of any program you use a thankyou message
inside your program, and only use PD programs.
No excuses for shabby doc displayers anymore.
End of chapter Thirty
^^^^^^^^^^^^^^^^^^^^^